<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        tr {
            text-align: center;
            line-height: 40px;
        }
    </style>
</head>
<body>
<input type="hidden" value="${operation}">
<form action="/empServlet?operation=${operation}" method="post">
    <input type="hidden"  name="id" value="${emp.id}">
    姓 名：<input type="text" name="ename" value="${emp.ename}"> <br>
    性 别：<input type="text" name="gender" value="${emp.gender}"> <br>
    薪 资：<input type="text" name="salary" value="${emp.salary}"> <br>
    籍 贯：<input type="text" name="address" value="${emp.address}"> <br>
    部门ID：<input type="text" name="dept_id" value="${emp.dept_id}"> <br>
    <button type="submit">提交</button>
</form>

<form action="/empServlet?operation=find" method="post">
    <button type="submit">查询</button>
</form>

<br>
<br>
<hr>
<br>
<br>
<table border="1px" cellpadding="0" cellspacing="0" align="center" width="700px">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>薪资</th>
        <th>居住地</th>
        <th>部门名称</th>
        <th>操作</th>
    </tr>

    <c:forEach items="${empList}" var="emps">
        <tr>
            <td>${emps.id}</td>
            <td>${emps.ename}</td>
            <td>${emps.gender}</td>
            <td>${emps.salary}</td>
            <td>${emps.address}</td>
            <td>${emps.dept.dname}</td>
            <td>
                <button><a href="/empServlet?operation=delete&empId=${emps.id}">删除</a></button>
                <button><a href="/empServlet?operation=toUpdate&empId=${emps.id}">编辑</a></button>
            </td>

        </tr>
    </c:forEach>














    <%--<tr>
        <td>1</td>
        <td>张三</td>
        <td>男</td>
        <td>10001</td>
        <td>成都</td>
        <td>研发部</td>
        <td>
            <button>删除</button>
            <button>编辑</button>
        </td>
    </tr>
    <tr>
        <td>1</td>
        <td>张三</td>
        <td>男</td>
        <td>10001</td>
        <td>成都</td>
        <td>研发部</td>
        <td>
            <button>删除</button>
            <button>编辑</button>
        </td>
    </tr>
    <tr>
        <td>1</td>
        <td>张三</td>
        <td>男</td>
        <td>10001</td>
        <td>成都</td>
        <td>研发部</td>
        <td>
            <button>删除</button>
            <button>编辑</button>
        </td>
    </tr>
    <tr>
        <td>1</td>
        <td>张三</td>
        <td>男</td>
        <td>10001</td>
        <td>成都</td>
        <td>研发部</td>
        <td>
            <button>删除</button>
            <button>编辑</button>
        </td>
    </tr>--%>
</table>
</body>
</html>
